return {
  -- tools
  {
    "mason-org/mason.nvim",
    opts = function(_, opts)
      vim.list_extend(opts.ensure_installed, {
        "codebook", -- 确保安装 codebook
        "cspell", -- 备用拼写检查
        "stylua",
        "selene",
        "luacheck",
        "shellcheck",
        "shfmt",
        "tailwindcss-language-server",
        "typescript-language-server",
        "css-lsp",
      })
    end,
  },

  {
    "mason-org/mason-lspconfig.nvim",
    opts = {
      ensure_installed = {
        "codebook", -- 确保 LSP 配置安装
      },
      automatic_installation = true, -- 自动安装
    },
  },

  -- lsp servers
  {
    "neovim/nvim-lspconfig",
    opts = {
      inlay_hints = { enabled = false },
      ---@type lspconfig.options
      servers = {
        cssls = {},
        tailwindcss = {
          root_dir = function(...)
            return require("lspconfig.util").root_pattern(".git")(...)
          end,
        },
        tsserver = {
          root_dir = function(...)
            return require("lspconfig.util").root_pattern(".git")(...)
          end,
          single_file_support = false,
          settings = {
            typescript = {
              inlayHints = {
                includeInlayParameterNameHints = "literal",
                includeInlayParameterNameHintsWhenArgumentMatchesName = false,
                includeInlayFunctionParameterTypeHints = true,
                includeInlayVariableTypeHints = false,
                includeInlayPropertyDeclarationTypeHints = true,
                includeInlayFunctionLikeReturnTypeHints = true,
                includeInlayEnumMemberValueHints = true,
              },
            },
            javascript = {
              inlayHints = {
                includeInlayParameterNameHints = "all",
                includeInlayParameterNameHintsWhenArgumentMatchesName = false,
                includeInlayFunctionParameterTypeHints = true,
                includeInlayVariableTypeHints = true,
                includeInlayPropertyDeclarationTypeHints = true,
                includeInlayFunctionLikeReturnTypeHints = true,
                includeInlayEnumMemberValueHints = true,
              },
            },
          },
        },
        html = {},
        yamlls = {
          settings = {
            yaml = {
              keyOrdering = false,
            },
          },
        },
        codebook = {
          -- 在这里添加 codebook 的具体配置
          filetypes = {
            "markdown",
            "text",
            "gitcommit",
            "org",
            "latex",
            "rst",
          },
          on_attach = function(client, bufnr)
            -- LSP 附加时的自定义配置
            vim.keymap.set("n", "<leader>cs", vim.lsp.buf.hover, { buffer = bufnr, desc = "Codebook suggestions" })
          end,
          settings = {
            -- 拼写检查配置
            spellCheck = {
              enabled = true,
              language = "en,zh-CN",
              checkComments = true,
              checkStrings = true,
            },
            -- 语法检查配置（仅英文）
            grammarCheck = {
              enabled = true,
              language = "en-US", -- 只启用英文语法检查
              rules = {
                -- 英文专用语法规则
                "EN_QUOTES",
                "UPPERCASE_SENTENCE_START",
              },
            },
          },
        },
        lua_ls = {
          -- enabled = false,
          single_file_support = true,
          settings = {
            Lua = {
              workspace = {
                checkThirdParty = false,
              },
              completion = {
                workspaceWord = true,
                callSnippet = "Both",
              },
              misc = {
                parameters = {
                  -- "--log-level=trace",
                },
              },
              hint = {
                enable = true,
                setType = false,
                paramType = true,
                paramName = "Disable",
                semicolon = "Disable",
                arrayIndex = "Disable",
              },
              doc = {
                privateName = { "^_" },
              },
              type = {
                castNumberToInteger = true,
              },
              diagnostics = {
                disable = { "incomplete-signature-doc", "trailing-space" },
                -- enable = false,
                groupSeverity = {
                  strong = "Warning",
                  strict = "Warning",
                },
                groupFileStatus = {
                  ["ambiguity"] = "Opened",
                  ["await"] = "Opened",
                  ["codestyle"] = "None",
                  ["duplicate"] = "Opened",
                  ["global"] = "Opened",
                  ["luadoc"] = "Opened",
                  ["redefined"] = "Opened",
                  ["strict"] = "Opened",
                  ["strong"] = "Opened",
                  ["type-check"] = "Opened",
                  ["unbalanced"] = "Opened",
                  ["unused"] = "Opened",
                },
                unusedLocalExclude = { "_*" },
              },
              format = {
                enable = false,
                defaultConfig = {
                  indent_style = "space",
                  indent_size = "2",
                  continuation_indent_size = "2",
                },
              },
            },
          },
        },
        -- 使用通配符 * 为所有 LSP 服务器添加自定义键映射
        ["*"] = {
          keys = {
            {
              "gd",
              "<cmd>FzfLua lsp_definitions jump1=true ignore_current_line=true<cr>",
              desc = "Goto Definition",
              has = "definition",
            },
            {
              "gr",
              "<cmd>FzfLua lsp_references jump1=true ignore_current_line=true<cr>",
              desc = "References",
              nowait = true,
            },
            {
              "gI",
              "<cmd>FzfLua lsp_implementations jump1=true ignore_current_line=true<cr>",
              desc = "Goto Implementation",
              has = "implementation",
            },
            {
              "gy",
              "<cmd>FzfLua lsp_typedefs jump1=true ignore_current_line=true<cr>",
              desc = "Goto T[y]pe Definition",
              has = "typeDefinition",
            },
          },
        },
      },
    },
  },
}
